package com.kun.portal.webframe.dao;

import com.kun.portal.webframe.po.DeptMgrPo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Administrator on 2018/5/21.
 */
@Repository
public interface DeptMgrDao extends JpaRepository<DeptMgrPo,String>,JpaSpecificationExecutor<DeptMgrPo> {


    @Query(
            nativeQuery = true,
            value = "select * from dept_mgr where parent_code in(select dept_code from dept_mgr where dept_id=?1)"
    )
    List<DeptMgrPo> findChildrenByDeptId(String var1);

    List<DeptMgrPo> findByParentCode(String var1);


}
